/*******************************************************************************
* Copyright (c) 2010, 2018 西安秦晔信息科技有限公司
* Licensed under the Apache License, Version 2.0 (the "License");
*    you may not use this file except in compliance with the License.
*    You may obtain a copy of the License at
*
*       http://www.apache.org/licenses/LICENSE-2.0
*
*    Unless required by applicable law or agreed to in writing, software
*    distributed under the License is distributed on an "AS IS" BASIS,
*    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*    See the License for the specific language governing permissions and
*    limitations under the License.
*******************************************************************************/
package com.qinyeit.serviceapp.service.pays;
import com.alibaba.fastjson.JSONObject;
import com.qinyetech.springstage.core.service.IBaseService;
import com.qinyeit.serviceapp.entity.DiscountPlan;

/** 
 * ClassName: DiscountPlanService <br/> 
 * Function: 折扣方案业务功能 <br/> 
 * date: 2018-11-29 09:56:09 <br/> 
 * 
 * @author liuwenjin
 * @version 1.0
 * @since JDK 1.8
 */
public interface DiscountPlanService extends IBaseService<DiscountPlan, Long>{

    /**
     * 保存折扣方案
     * @param data
     *    discountPlans{
     *        type:AllSINGLE, 类型
     *        name:方案名称
     *        hasVip：是否会员折扣
     *        storeId：菜品库 （方案折扣选择菜品库）
     *        startTime：2018-12-12 00:00:00
     *        endTime：2018-11-12 23:59:59
     *        discount：折扣率
     *    }
     *    dishesCount:[
     *      {
     *          categoryId:12 类别
     *          dishesId：null 菜品id
     *          rate：30 折扣率
     *      },
     *      {
     *          categoryId:12 类别
     *          dishesId：2 菜品id
     *          rate：30 折扣率
     *      }
     *    ]
     * @param merchantGroupId
     * @param operator
     */
    void saveData(JSONObject data,Long merchantGroupId,String operator);

    /**
     * 保存分配机构
     * @param data
     *      ids:[1,2,3] 折扣ids
     *      branchs:[1,2,3] 门店ids
     */
    void allocationBranchSave(JSONObject data);

    /**
     * 判断分店的折扣方案是否被使用
     * @param plan
     */
    Long branchUseCountForDiscountPlan(DiscountPlan plan);

    /**
     * 物理删除分店的折扣方案
     * @param plan
     */
    void deleteBranchDiscountPlanData(DiscountPlan plan);
}